<template>
  <div class="app-container">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>用电管理</span>
        </div>
      </template>
      <div class="electricity-management">
        <el-table :data="managementList" style="width: 100%">
          <el-table-column prop="name" label="管理项目" />
          <el-table-column prop="value" label="数值" />
          <el-table-column prop="unit" label="单位" />
          <el-table-column prop="status" label="状态">
            <template #default="scope">
              <el-tag
                :type="scope.row.status === '正常' ? 'success' : 'warning'"
              >
                {{ scope.row.status }}
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column label="操作">
            <template #default="scope">
              <el-button size="small" @click="handleEdit(scope.row)"
                >编辑</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>

<script setup>
import { ref } from "vue";

const managementList = ref([
  { name: "日用电量限制", value: "5000", unit: "kWh", status: "正常" },
  { name: "峰值功率限制", value: "1000", unit: "kW", status: "正常" },
  { name: "设备维护周期", value: "30", unit: "天", status: "正常" },
]);

const handleEdit = (row) => {
  console.log("编辑", row);
};
</script>

<style lang="scss" scoped>
.electricity-management {
  padding: 20px;
}
</style>
